<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>js测试对象添加属性</title>
</head>
<body>
<script type="text/javascript">
    var p="pp"
    var k={k:'1'}
    if(!k[p]){
        alert(false);
    }
    k[p]=3;
    // {"k":"1","pp":3}
    alert(JSON.stringify(k));
</script>
</body>
</html>